home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: uu4news.netcom.com!friend!news
- From: rich@kastle.com (Richard Krehbiel)
- Subject: Re: Standard question - pointer initialization
- Message-ID: <1996Mar14.113012.7984@friend.kastle.com>
- Sender: news@friend.kastle.com (News)
- Reply-To: rich@kastle.com
- Organization: Kastle Development Associates
- X-Newsreader: Forte Free Agent 1.0.82
- References: <4hk9un$906@hammer.msfc.nasa.gov> <4i52bk$5el@s02.pavilion.co.uk> <TANMOY.96Mar12211525@qcd.lanl.gov>
- Date: Thu, 14 Mar 1996 11:29:28 GMT
-
- tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
-
- >In article <4i52bk$5el@s02.pavilion.co.uk>
- >AJRobb@pavilion.co.uk (Andy J Robb) writes:
- ><snip>
- >AJR: Off the top of my head, the only time pointers are initialized to NULL
- >AJR: is if they are global or static.
-
- >Correct. (I mean unless explicitly initialized to NULL).
-
- >AJR:
- >AJR: The use of calloc() allows a list of NULL initialized pointers to be
- >AJR: generated. It is a good idea while code is being developed as it
-
- >Absolute nonsense. calloc generates memory initialized to all bits
- >zero. This has no relation to null pointers except in confused ramblings.
-
- The standard says that a 0 in a pointer context is converted into the
- NULL pointer in the native representation. In the vast majority of
- cases, 0 already IS the bit pattern for NULL. But you're not supposed
- to write code as if you know that.
-
- However, I still believe I should be allowed to ponder, meditate,
- analyze, and then decide for myself whether I should concern myself
- with those computing platforms with representations of NULL and 0.0
- other than all-bits-zero. And CHAR_BIT other than 8. Some of my code
- won't run on those (and some will), but I've decided that's alright.
-
- C not only lets you write really portable stuff, it also lets you
- write really platform/compiler/vendor-specific stuff, and that's a
- GOOD thing.
-
- --
- Richard Krehbiel, Kastle Systems, Arlington VA USA
- rich@kastle.com (work) or richk@mnsinc.com (personal)
-
-